<link href="/assets/js/validate/jquery.validate.css" type="text/css" rel="stylesheet" />
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/additional-methods.min.js" type="text/javascript"></script>
<script src="/assets/js/form/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
	// post-submit callback 
	function showResponse(responseText, statusText, xhr, $form)  { 
		if (responseText.length == 0)
		{
			window.location.href = "/blogger/dashboard"; 
		}
	} 
	
	$(function(){
		$("#inputForm").validate({
			submitHandler: function(form) {
				var options = { 
					target: '#result',   // target element(s) to be updated with server response 
					success: showResponse  // post-submit callback 
				}; 
				jQuery(form).ajaxSubmit(options);
				return false;
		    }, 
		    rules: {
				email: {
					required: true,
					email: true,
					minlength: 4,
					maxlength: 127,
					remote: {
						url: "/ajax/CheckUser/exist",
						type: "post",
						email: function() {
							return $("#email").val();
						}
					}
				}
			},
			messages : {
				email: {
					required: "请填写您的Email",
					email: "请填写正确的邮箱",
					remote: "此邮箱不存在"
				}
			}
		});
	});
</script>
<div id="page" class="wrapper w_960 clearfix">
  <h2 class="heading">用户登录</h2>
  <div id="content" class="col first_col b1">
    <form name="f" action="/ajax/login" method="post" id="inputForm">
      <div class="row clearfix">
        <label for="email">邮箱:</label>
        <p><span class="">
          <input id="email" name="email" type="text" maxlength="50" class="inputs med" value="">
          </span></p>
      </div>
      <div class="row clearfix">
        <label for="password">密码:</label>
        <p><span>
          <input type="password" maxlength="20" class="inputs med required" name="password">
          </span></p>
      </div>
      <div class="row clearfix">
          <input type="checkbox" name="terms" checked="checked" id="terms" class="inputs checkbox">
          <label for="terms" class="normal"> <a>记住密码</a></label>
      </div>
      <div id="result" class="row clearfix"></div>
      <div class="row clearfix">
        <input type="submit" name="submitBtn" id="submitBtn" class="submit" value="登陆">
        <a href="/user/forgot" class="second_opt">忘记密码?</a> </div>
    </form>
  </div>
</div>
